package com.zq.多线程设计模式.Future设计模式;

/**
 * @author Jiu
 * @description：TODO
 * @date 2021/04/07   13:23
 **/
public class RealData implements Data {
    protected String data;

    public RealData(String data) {
        // 利用sleep方法来表示RealData构造过程是非常缓慢的
        try {
            Thread.sleep(1500);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        this.data = data;
    }

    @Override
    public String getResult() throws InterruptedException {
        return data;
    }
}